package com.testpro.learn.springbootscala

import com.testpro.learn.springbootjava.Person
import javax.annotation.Resource
import org.springframework.stereotype.Controller
import org.springframework.web.bind.annotation.{RequestMapping, RequestMethod, ResponseBody}

@Controller
@ResponseBody
@RequestMapping(value = Array("/"))
class personController {
  @Resource(name = "person") var person: Person = _


  @Resource(name = "ChinaPerson") var chinaPerson: ChinaPerson = _

  @RequestMapping(value = Array("/index"), method = Array(RequestMethod.GET))
  def getPerson(): Person = {
    val person = new Person()
    person.setName("张三")
    person.setAge("999")
    person
  }


  @RequestMapping(value = Array("/person"), method = Array(RequestMethod.GET))
  def index(): Person = {
    person
  }

  @RequestMapping(value = Array("/ChinaPerson"), method = Array(RequestMethod.GET))
  def ChinaPerson(): ChinaPerson = {
    //    此处对象不可被正确转至成JSON数据类型 后期再看
    chinaPerson

  }
}
